<template>
	<div>
		<el-tabs v-model="activeName" @tab-click="handleClick">
			<el-tab-pane label="未入库车辆" name="first">
				<el-row :gutter="24">
					<el-col :span="1" style="margin-right:0px;">
						<p class="queryLabel">入库日期:</p>
					</el-col>
					<el-col :span="7">
						<el-date-picker size="small" style="width: 150px; margin-right:15px;" v-model="condition.startDate" format="yyyy-MM-dd" :editable=false type="date" placeholder="起始日期">
						</el-date-picker>
						至
						<el-date-picker size="small" style="width: 150px; margin-left:15px;" v-model="condition.stopDate" format="yyyy-MM-dd" :editable=false type="date" placeholder="结束日期">
						</el-date-picker>
					</el-col>
					<el-col :span="1" style="margin-right:0px;">
						<p class="queryLabel">入库类型:</p>
					</el-col>
					<el-col :span="3" style="margin-right: 0px;">
						<el-select size="small" v-model="condition.enterWarehouseType" placeholder="请选择入库类型" clearable>
							<el-option v-for="item in enterWarehouseType" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>
					<el-col :span="1" style="margin-right:0px;">
						<p class="queryLabel">库龄:</p>
					</el-col>
					<el-col :span="3" style="margin-right: 0px;">
						<el-select size="small" v-model="condition.enterWarehouseAge" placeholder="请选择入库库龄" clearable>
							<el-option v-for="item in enterWarehouseAge" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>
					<el-col :span="1" style="margin-right:0px;">
						<p class="queryLabel">车型:</p>
					</el-col>
					<el-col :span="4" size="small" style="margin-right:0px;">
						<el-input placeholder="请选择车型" icon="search" v-model="condition.carModel" :on-icon-click="handleIconClick">
						</el-input>
					</el-col>
					<el-col :span="1" style="text-align: right;margin-left:0px;">
						<el-button type="primary" size="small" v-on:click="add">新增入库</el-button>
						<!--<el-button type="primary" size="small" v-on:click="addNoStore">新增非本店入库</el-button>-->
					</el-col>
					<el-col :span="2" style="padding-left: 0px;text-align: right">
						<el-button type="primary" size="small" v-on:click='enterWarehouseQuery()'>查询</el-button>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-table :data="tableData.dataList" border style="width: 100%;align-content: center;"  @selection-change="handleSelectionChange">
							<el-table-column type="selection" width="55" label="选择">
							</el-table-column>
							<el-table-column label="VIN" prop="vin">
							</el-table-column>
							<el-table-column label="车型" align="right" prop="modelName">
							</el-table-column>
							<el-table-column label="仓库" align="right" prop="warehouseName">
							</el-table-column>
							<el-table-column label="配置" align="right" prop="configureName">
							</el-table-column>
							<el-table-column label="外观" align="right" prop="colorName">
							</el-table-column>
							<el-table-column label="内饰" align="right" prop="trimName">
							</el-table-column>
							<el-table-column label="合格证" align="right" prop="certificateNum">
							</el-table-column>
							<el-table-column label="入库日期" align="right" prop="enterDate">
							</el-table-column>
						</el-table>
						<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
						</el-pagination>
					</el-col>
				</el-row>
			</el-tab-pane>
			<el-tab-pane label="已入库车辆" name="second">
				<el-row :gutter="24">
					<el-col :span="1" style="margin-right:0px;">
						<p class="queryLabel">入库日期:</p>
					</el-col>
					<el-col :span="7">
						<el-date-picker size="small" style="width: 150px; margin-right:15px;" v-model="condition.startDate" format="yyyy-MM-dd" :editable=false type="date" placeholder="起始日期">
						</el-date-picker>
						至
						<el-date-picker size="small" style="width: 150px; margin-left:15px;" v-model="condition.stopDate" format="yyyy-MM-dd" :editable=false type="date" placeholder="结束日期">
						</el-date-picker>
					</el-col>

					<el-col :span="1" style="margin-right:0px;">
						<p class="queryLabel">入库类型:</p>
					</el-col>
					<el-col :span="3" style="margin-right: 0px;">
						<el-select size="small" v-model="condition.enterWarehouseType" placeholder="请选择入库类型" clearable>
							<el-option v-for="item in enterWarehouseType" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>
					<el-col :span="1" style="margin-right:0px;">
						<p class="queryLabel">库龄:</p>
					</el-col>
					<el-col :span="3" style="margin-right: 0px;">
						<el-select size="small" v-model="condition.enterWarehouseAge" placeholder="请选择入库库龄" clearable>
							<el-option v-for="item in enterWarehouseAge" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-col>

					<el-col :span="1" style="margin-right:0px;">
						<p class="queryLabel">车型:</p>
					</el-col>
					<el-col :span="4" size="small" style="margin-right:0px;">
						<el-input placeholder="请选择车型" icon="search" v-model="condition.carModel" :on-icon-click="handleIconClick">
						</el-input>
					</el-col>
					<el-col :span="1" style="text-align: right;margin-left:0px;">
						<!--<el-button type="primary" size="small" v-on:click="add">新增入库</el-button>-->
						<!--<el-button type="primary" size="small" v-on:click="addNoStore">新增非本店入库</el-button>-->
					</el-col>

					<el-col :span="2" style="padding-left: 0px;text-align: right">
						<el-button type="primary" size="small" v-on:click='enterWarehouseQuery()'>查询</el-button>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-table :data="tableData.dataList" border style="width: 100%;align-content: center;">
							<el-table-column label="VIN" prop="vin">
							</el-table-column>
							<el-table-column label="车型" align="right" prop="modelName">
							</el-table-column>
							<el-table-column label="仓库" align="right" prop="warehouseName">
							</el-table-column>
							<el-table-column label="配置" align="right" prop="configureName">
							</el-table-column>
							<el-table-column label="外观" align="right" prop="colorName">
							</el-table-column>
							<el-table-column label="内饰" align="right" prop="trimName">
							</el-table-column>
							<el-table-column label="合格证" align="right" prop="certificateNum">
							</el-table-column>
							<el-table-column label="入库日期" align="right" prop="enterDate">
							</el-table-column>
						</el-table>
						<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
						</el-pagination>
					</el-col>
				</el-row>
			</el-tab-pane>
		</el-tabs>
		<!--
        	作者：hongchao_zhu@hongdee-info.com
        	时间：2017-05-12
        	描述：车型车系选择框
        -->

		<el-dialog title="选择车系" v-model="showStart" size="small">
			<el-row :gutter="24">

				<el-col :span="11" style="margin-left:5px;">
					<el-input size="small" v-model="dictTreeSearchValue" placeholder="请输入内容" icon="search" @click="searchTree"></el-input>
				</el-col>
				<el-col :span="11" style="margin-left:5px;">
				</el-col>
				<el-col :span="24" style="margin-left:5px;">
					<div style="height: 3em;"></div>
				</el-col>
				<el-col :span="24" style="margin-left:5px;">
					<el-tree :data="paramTreeData" :filter-node-method="filterNode" :highlight-current=true :props="defaultProps" accordion @node-click="handleNodeClick" :auto-expand-parent=false ref="dictTree" node-key="id"></el-tree>
				</el-col>
			</el-row>

			<div slot="footer" class="dialog-footer">
				<el-button @click="showStart = false">取 消</el-button>
				<el-button type="primary" @click="saveCarSerices()">提 交</el-button>
			</div>
		</el-dialog>

		<!--//新增-->

		<el-dialog title="新增入库" v-model="addFormShow" size="small">
			<el-row :gutter="24">
				<el-col :span="2" style="">
					<p class="queryLabel">车辆品牌:</p>
				</el-col>
				<el-col :span="8">
					<el-input size="small" style="" v-model="conditionCar.brand" placeholder="请输入品牌">
					</el-input>
				</el-col>
				<el-col :span="2" style="">
					<p class="queryLabel">车辆型号:</p>
				</el-col>
				<el-col :span="8">
					<el-input size="small" style="" v-model="conditionCar.carModel" placeholder="请输入车型">
					</el-input>
				</el-col>
				<el-col :span="4">
					<p class="queryLabel"></p>
				</el-col>
				<el-col :span="2" style="">
					<p class="queryLabel">车架号:</p>
				</el-col>
				<el-col :span="8">
					<el-input size="small" style="" v-model="conditionCar.vin" placeholder="请输入车架号">
					</el-input>
				</el-col>
				<el-col :span="2" style="">
					<p class="queryLabel">提单号:</p>
				</el-col>
				<el-col :span="8">
					<el-input size="small" style="" v-model="conditionCar.oldNum" placeholder="请输入单号">
					</el-input>
				</el-col>
				<el-col :span="4">
					<p class="queryLabel"></p>
				</el-col>
				<el-col :span="2" style="">
					<p class="queryLabel">入库单号:</p>
				</el-col>
				<el-col :span="8">
					<el-input size="small" style="" v-model="conditionCar.enterWarehouseNum" placeholder="请输入单号">
					</el-input>
				</el-col>

				<el-col :span="2" style="padding-left: 0px;text-align: right">
					<el-button type="primary" size="small" v-on:click='carQuery'>查询</el-button>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-table :data="tableDataCar.dataList" border style="width: 100%;align-content: center;" @selection-change="handleSelectionChangeCar">
						<el-table-column type="selection" width="60">
						</el-table-column>
						<el-table-column label="vin" prop="vin" width="180">
						</el-table-column>
						<el-table-column label="配置" align="right" prop="configureName">
						</el-table-column>
						<el-table-column label="型号" align="right" prop="modelName">
						</el-table-column>
						<el-table-column label="内饰" align="right" prop="trimName">
						</el-table-column>
						<el-table-column label="颜色" align="right" prop="colorName">
						</el-table-column>
						<el-table-column label="合格证号" align="right" prop="certificateNum">
						</el-table-column>
						<!--<el-table-column label="颜色" align="right" prop="colorName">
						</el-table-column>-->
					</el-table>
					<!--<el-pagination small @size-change="handleSizeChangeCar" @current-change="handleCurrentChangeCar" :current-page="CurentPageCar" :page-size="pageCar.pageSize" layout=" total,prev, pager, next" :total="tableDataCar.total">
					</el-pagination>-->
				</el-col>
			</el-row>

			<el-row>
				<el-card class="box-cards">
					<el-form :model="formData.addFormData" ref="addFormData" :rules="addRule" label-width="80px">
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="入库仓库" required prop="warehouseId">
								<el-select v-model="formData.addFormData.warehouseId" left size="small" placeholder="请选择仓库">
									<el-option v-for="item in warehouseId" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="11">
							<el-form-item label="入库日期" prop="enterDate" required>
								<el-date-picker size="small" style="width: 150px;" v-model="formData.addFormData.enterDate" format="yyyy-MM-dd" :editable=false type="date" placeholder="起始日期">
								</el-date-picker>
							</el-form-item>
						</el-col>
						<!--<el-col :span="23" style="margin-right:20px;">
						<el-form-item label="车型" required prop="carModel">
							<el-input placeholder="请选择车型" icon="search" v-model="formData.addFormData.carModel" :on-icon-click="handleIconClick">
							</el-input>
						</el-form-item>
					</el-col>-->

					</el-form>
				</el-card>
			</el-row>

			<div slot="footer" class="dialog-footer">
				<el-button @click="addFormShow = false">取 消</el-button>
				<el-button type="primary" v-on:click='saveCar'>提 交</el-button>
			</div>
		</el-dialog>

		<!--非本店新增入库-->

		<!--非本店新增入库-->
		<el-dialog title="非本店新增入库" v-model="addNoStoreFormShow" size="small">
			<el-row>
				<el-card class="box-card">
					<el-form :model="addNoStoreFormData" ref="addNoStoreForm" :rules="addNoStoreRule" label-width="80px">
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="品牌" required prop="brand">
								<el-input size="small" v-model="addNoStoreFormData.brand"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="车型" required prop="carModelCode">
								<el-input size="small" v-model="addNoStoreFormData.carModelCode"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="颜色" required prop="colorName">
								<el-input size="small" v-model="addNoStoreFormData.colorName"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="配置" required prop="configure">
								<el-input size="small" v-model="addNoStoreFormData.configure"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="排量" required prop="output">
								<el-input size="small" v-model="addNoStoreFormData.output"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="VIN" required prop="vin">
								<el-input size="small" v-model="addNoStoreFormData.vin"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:15px;">
							<el-form-item label="暂估成本" prop="estimatedCost" required>
								<el-input size="small" v-model="addNoStoreFormData.estimatedCost"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11">
							<el-form-item label="财务归属" prop="financialBelong" required>
								<el-select size="small" v-model="addNoStoreFormData.financialBelong" placeholder="选择财务归属">
									<el-option v-for="item in financialBelong" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="11">
							<el-form-item label="是否可售" prop="carSaleStatus" required>
								<el-select size="small" v-model="addNoStoreFormData.carSaleStatus" placeholder="选择销售状态">
									<el-option v-for="item in carSaleStatus" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
					</el-form>
				</el-card>
			</el-row>
			<el-row>
				<!--存入库存表的信息-->
				<el-form :model="addNoStoreFormDatas" ref="addNoStoreForms" :rules="addNoStoreRule" label-width="80px">
					<el-col :span="11" style="margin-right:20px;">
						<el-form-item label="入库仓库" required prop="warehouseId">
							<el-select v-model="formNoStoreDatas.addNoStoreFormDatas.warehouseId" left size="small" placeholder="请选择仓库">
								<el-option v-for="item in warehouseId" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="11">
						<el-form-item label="入库日期" required prop="enterDate">
							<el-date-picker size="small" style="width: 150px;" v-model="formNoStoreDatas.addNoStoreFormDatas.enterDate" format="yyyy-MM-dd" :editable=false type="date" placeholder="出单日期">
							</el-date-picker>
						</el-form-item>
					</el-col>
				</el-form>
			</el-row>
			<div slot="footer" class="dialog-footer">
				<el-button @click="addNoStoreFormShow = false">取 消</el-button>
				<el-button type="primary" @click="saveNoStore">提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog tittl="打印" v-model="dayinFormShow" id="dvData" size="large">
			<div id="printHtml" style=" width: 100%;">
				<font face="宋体">
					<el-row>
						<div id="" style="margin-left: 35%; width: 65%;">
							<font face="宋体">
								<div style="border-collapse:collapse;font-size: 30px;margin:0 auto;color:#000000">
									车辆出库单
									<div style="border-collapse:collapse;font-size: 20px;margin:0 auto;color:#000000;margin-left: 25%;">1231321</div>
								</div>
							</font>
						</div>

					</el-row>
					<div>
						<table>
							<tr>
								<td width="1%">
									○请在此打孔装订○
								</td>
								<td width="97%">
									<table width="80%" border="1px solid #000000" cellspacing="0px" cellpadding="10px" bgcolor="#FFFFFF" style="border-collapse:collapse;font-size: 10px;margin:0 auto;color:#1F2D3D">
										<tr>
											<td width="20%" colspan="3"><b>车型:</b></td>
											<td width="15%" colspan="2"><b>颜色:</b></td>
											<td width="35%" colspan="1"><b>车架号码(后八位):</b></td>
											<td width="30%" colspan="1"><b>发票号</b></td>
										</tr>
										<tr>
											<td rowspan="6" width="10%" colspan="1"><b>销售部分填写</b></td>
											<td colspan="6">出库原因:</td>
										</tr>
										<tr>
											<td colspan="6">
												<div style="float:left;width: 50px;"><b>□销售</b></div>
												<div style=" float:left; width: 170px;"><b>客户名字:</b></div>
												<div style=" float:left; width: 170px;"><b>地址:</b></div>
												<div style=" float:left; width: 170px;"><b>电话:</b></div>
											</td>
										</tr>
										<tr>
											<td colspan="6">
												<div style="float:left;width: 50px;"><b>□车展</b></div>
												<div style=" float:left; width: 100px;"><b>车展名称:</b></div>
												<div style=" float:left; width: 100px;"><b>地点:</b></div>
												<div style=" float:left; width: 100px;"><b>起止时间:</b></div><b>授权□未授权□</b></td>
										</tr>
										<tr>
											<td colspan="6">
												<div style="float:left;width: 50px;"><b>□二级</b></div>
												<div style=" float:left; width: 100px;"><b>网络名称:</b></div>
												<div style=" float:left; width: 100px;"><b>移出点:</b></div>
												<div style=" float:left; width: 100px;"><b>移入点:</b></div><b>授权□未授权□</b></td>
										</tr>
										<tr>
											<td colspan="6">
												<div style="float:left;width: 50px;"><b>□移库</b></div>
												<div style=" float:left; width: 100px;"><b>原因:</b></div>
												<div style=" float:left; width: 100px;"><b>移出点:</b></div>
												<div style=" float:left; width: 100px;"><b>移入点:</b></div>
											</td>
										</tr>
										<tr>
											<td colspan="6">
												<div style="float:left;width: 100px;"><b>销售经理签字:</b></div>
												<div style="float:left;width: 100px;"><b>地址</b></div>
												<div style="float:left;width: 100px;"><b>电话</b></div>
											</td>
										</tr>
										<tr>
											<td rowspan="2" colspan="1">财务部门填写</td>
											<td colspan="6">如是销售，请填写：<br>
												<div style="float:left;width: 100px;"><b>客户类型:□个人</b></div>
												<div style="float:left;width: 100px;"><b>□单位</b></div>
												<div style="float:left;width: 100px;"><b>□其他(</b></div>
												<div style="float:left;width: 100px;"><b>)</b></div><br>
												<div style="float:left;width: 400px;"><b>付款方式: □现金□支票□电汇□GMACSAIC零售汇款□银行按揭□其他</b></div>
											</td>
										</tr>
										<tr>
											<td colspan="7">
												<div style="float:left;width: 150px;"><b>销售经理签字:</b></div>
												<div style="float:left;width: 100px;"><b>地址</b></div>
												<div style="float:left;width: 70px;"><b>日期:</b></div>
												<div style="float:left;width: 50px;"><b>年</b></div>
												<div style="float:left;width: 50px;"><b>月</b></div>
												<div style="float:left;width: 50px;"><b>日</b></div>
											</td>
										</tr>
										<tr>
											<td colspan="7">
												<div style="float:left;width: 120px;"><b>库管签字:</b></div>
												<div style="float:left;width:200px;"><b>日期:</b></div>
												<div style="float:left;width: 50px;"><b>年</b></div>
												<div style="float:left;width: 50px;"><b>月</b></div>
												<div style="float:left;width: 50px;"><b>日</b></div>
											</td>
										</tr>
										<tr>
											<td colspan="7">
												<div style="float:left;width: 300px;"><b>提车人:</b></div>
												<div style="float:left;width: 50px;"><b>年</b></div>
												<div style="float:left;width: 50px;"><b>月</b></div>
												<div style="float:left;width: 50px;"><b>日</b></div>
											</td>
										</tr>
										<tr>
											<td colspan="7"><b>备注：</b></td>
										</tr>
									</table>

								</td>
								<td valign="middle">
									<div style="font-size:12px!important;height: 300px; width: 12px;">
										请按照背面注意事项认真填写，涂改或复印无效
									</div>
								</td>
							</tr>
						</table>
					</div>
					<el-row>
						<div id="" style=" float: left;padding: 10px;">
							注意事项:<br> 1:出库单一式两联,销售部门掌握车辆出库单本票，签发出库单
							<br> 2:出库单必须保持序号连续，不能跳号，涂改，序号的缺失视作违规
							<br> 3:出库单涂改则注明“作废”，并保留“作废件”，并且在下一张顺次序号的出库单上重新填写
							<br> 4:每月下班后，库管将出库单原件（包括作废件）全部按编号次序归档
							<br>
						</div>
					</el-row>
				</font>
			</div>
			<!--底部的注意 结束-->
			<el-row style="margin-left:5px">
				<el-col>
					<el-button type="primary" @click="saveDayin">点击打印</el-button>
				</el-col>
			</el-row>
		</el-dialog>
	</div>
</template>
<script>
	import moment from 'moment'
	export default {
		data: function() {
			return {
				//选中的列
				multipleSelection: [],
				//tab默认显示
				activeName: 'first',
				//车辆财务归属下拉
				financialBelong: [],

				//车辆销售状态
				carSaleStatus: [],

				//车辆入库类型下拉
				enterWarehouseType: [],

				//车辆入库库龄下拉
				enterWarehouseAge: [],

				//公司仓库下拉
				warehouseId: [],

				//页码数
				CurentPage: 1,
				//每页的数量
				page: this.page,
				//公司数据
				tableData: {
					total: 0,
					dataList: []
				},

				tableDataCar: {
					total: 0,
					dataList: []
				},

				conditionCar: {
					vin: "", //、
					brand: "", //品牌、
					oldNum: "", //提单号、
					carModel: "", //车型
					enterWarehouseNum: ""
				},

				//初始页面列表
				condition: {
					startDate: "",
					stopDate: "",
					enterWarehouseType: "",
					carMolde: "",
					enterWarehouseAge: "",

				},

				//本店新增表单数据
				addFormData: {

					vin: "",
					warehouseId: "",
					enterDate: "",
					carModel: "",

				},
				//初始化本店新增表单数据
				addEmptyData: {

					vin: "",
					warehouseId: "",
					enterDate: "",
					carModel: "",
					enterReason: "",
					source: "",
				},

				formData: {

					addFormData: {
						vin: "",
						warehouseId: "",
						enterDate: "",
						carModel: "",
					},
					multipleSelectionCar: [],

				},

				formEmptyData: {

					addFormData: {
						vin: "",
						warehouseId: "",
						enterDate: "",
						carModel: "",
					},
					multipleSelectionCar: [],

				},

				//非本店新增表单数据
				addNoStoreFormData: {
					brand: "",
					carModel: "",
					colorName: "",
					modelName: "",
					trimName: "",
					configureName: "",
					configure: "",
					output: "",
					vin: "",
					estimatedCost: "",
					financialBelong: "",
					carSaleStatus: "",

				},
				//初始化非本店新增表单数据
				addNoStoreEmptyData: {
					brand: "",
					carModel: "",
					colorName: "",
					modelName: "",
					trimName: "",
					configureName: "",
					configure: "",
					output: "",
					vin: "",
					estimatedCost: "",
					financialBelong: "",
					carSaleStatus: "",

				},

				addNoStoreFormDatas: {
					warehouseId: "",
					enterDate: "",

				},
				addNoStoreFormEmptyDatas: {
					warehouseId: "",
					enterDate: "",

				},

				//非本店
				formNoStoreDatas: {
					addNoStoreFormDatas: {
						warehouseId: "",
						enterDate: "",
						vin: "",
					}

				},
				formNoStoreEmptyDatas: {

					addNoStoreFormEmptyDatas: {
						warehouseId: "",
						enterDate: "",
						vin: "",
					},

				},

				//校验规则

				addRule: {
					warehouseId: [{
						required: true,
						message: '请选择仓库',
						trigger: 'blur'
					}],
				},

				addNoStoreRule: {

				},

				multipleSelection: [],

				//查询待入库车辆
				//multipleSelectionCar: [],
				//companyId: "",

				//树形图查询条件
				dictTreeSearchValue: "",
				paramTreeData: [],
				//树型数据配置
				defaultProps: {
					children: 'child',
					label: 'label',
				},
				showStart: false,

				addFormShow: false,
				addNoStoreFormShow: false,

				//选中的类型（车型/车系）
				carType: '',
				//选择的车辆信息
				datalabel: '',
				datavale: '',

				type: '',

			}
		},
		methods: {
			
			//tab切换的回调函数
			handleClick(tab, event) {
				//先清空查询条件
//				this.clean();
//				debugger;
//				if(tab.name == "first") {
//					this.$data.queryStatus = "0"
//				} else {
//					this.$data.queryStatus = "3"
//				}
//				this.$data.CurentPage = 1
//				this.query();
			},
			//时间判断为空的封装
			momentFu: function(dt) {
				if(dt == '' || dt == null || dt == undefined) {
					return "";
				} else {
					return this.moment(dt).format("YYYY-MM-DD");
				}
			},

			//新增入库
			add: function() {

				this.$data.formData.addFormData = Object.assign(this.$data.formData.addFormData, this.$data.formEmptyData.addFormData)
				this.$data.addFormShow = true;
				this.carQuery();
			},

			//新增非本店入库
			addNoStore: function() {

				this.$data.addNoStoreFormData = Object.assign(this.$data.addNoStoreFormData, this.$data.addNoStoreEmptyData)
				this.$data.formNoStoreDatas = Object.assign(this.$data.formNoStoreDatas, this.$data.formNoStoreEmptyDatas)
				this.$data.addNoStoreFormShow = true;
			},

			//查询待选择入库的车辆
			carQuery: function() {
				this.$http.post(this.API_ROOT + '/scm/car/listCar', this.$data.conditionCar, {
					params: {}
				}).then(resp => {
					this.$data.tableDataCar.dataList = resp.data;
				}, resp => {});
			},

			//查询已入库车辆
			enterWarehouseQuery: function() {
				debugger;
				this.$http.post(this.API_ROOT + '/scm/stock/page', this.$data.condition, {
					params: {
						start: this.$data.CurentPage,
						limit: this.$data.page.pageSize,
					}
				}).then(resp => {
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						// es5写法
						debugger;
						this.$data.tableData = resp.data;
						//this.baseQuery(this.$data.curTreeDeptId);
						//this.$data.exFormShow = false;
					} else {
						//debugger;
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},

			//保存已选择的车辆、仓库ID和入库时间
			saveCar: function() {
				debugger;
				this.$data.formData.addFormData.enterDate = this.moment(this.$data.formData.addFormData.enterDate).format("YYYY-MM-DD");
				this.$http.post(this.API_ROOT + '/scm/stock/save', this.$data.formData, {
						params: {
							type: '0',
						}
					})
					.then(resp => {
						if(resp.data.success) {
							debugger;
							this.enterWarehouseQuery();
							this.$data.addFormShow = false;
						} else {
							this.$message.error(resp.data.msg);
						}
					}, resp => {});
			},

			//非本店入库时保存车辆信息

			saveNoStore: function(index) {

				debugger;
				this.$refs.addNoStoreForm.validate(function(valid) {
					if(valid) {
						this.$http.post(this.API_ROOT + '/scm/car/save', this.$data.addNoStoreFormData)
							.then(resp => {
								if(resp.data.success) {
									this.$message(resp.data.msg);
									this.$data.addNoStoreFormShow = false;
									this.saveEnterWarehouses();

								} else {
									this.$message.error(resp.data.msg);
								}
							}, resp => {

							});
					}
					return false;
				}.bind(this));

			},

			//非本店入库时存的保存到入库表的信息

			saveEnterWarehouses: function() {
				debugger;
				this.$data.formNoStoreDatas.addNoStoreFormDatas.enterDate = this.moment(this.$data.formNoStoreDatas.addNoStoreFormDatas.enterDate).format("YYYY-MM-DD");
				this.$data.formNoStoreDatas.addNoStoreFormDatas.vin = this.$data.addNoStoreFormData.vin;
				this.$http.post(this.API_ROOT + '/scm/stock/save', this.$data.formNoStoreDatas, {
						params: {
							type: '1',
						}
					})
					.then(resp => {
						if(resp.data.success) {
							debugger;
							this.enterWarehouseQuery();
							this.$data.addNoStoreFormShow = false;
						} else {
							this.$message.error(resp.data.msg);
						}
					}, resp => {});
			},

			//			saveEnterWarehouses: function(index) {
			//				debugger;
			//				this.$refs.addNoStoreFormDatas.validate(function(valid) {
			//					if(valid) {
			//						this.$http.post(this.API_ROOT + '/scm/stock/save', this.$data.addNoStoreFormDatas)
			//							.then(resp => {
			//								if(resp.data.success) {
			//									this.$message(resp.data.msg);
			//								} else {
			//									this.$message.error(resp.data.msg);
			//								}
			//							}, resp => {
			//
			//							});
			//					}
			//					return false;
			//				}.bind(this));
			//
			//			},

			//确认车型
			saveCarSerices: function() {
				debugger;
				if(this.$data.carType == '1') {
					this.$data.condition.carModel = this.$data.datavale;
				} else {
					this.$message("未选中车型");
				}
				this.$data.showStart = false;
			},

			//打开车型车系选择
			handleIconClick: function() {
				this.$data.showStart = true;
			},

			//查询树节点
			searchTree: function() {
				if(this.$data.dictTreeSearchValue == "") {
					this.$message("请输入查询条件");
					this.queryParamTree();
					return;
				}
				this.$refs.dictTree.filter(this.$data.dictTreeSearchValue);
			},
			//点击资源树节点
			handleNodeClick(data) {
				debugger;
				this.$data.carType = data.type;
				this.$data.datalabel = data.label;
				this.$data.datavale = data.value;
			},
			//查询参数树
			queryParamTree: function() {
				//获取资源树
				debugger;
				this.$http.get(this.API_ROOT + '/base/car/tree', {

				}).then((response) => {
					this.$data.paramTreeData = response.data;
				}, (response) => {});
			},
			//资源过滤
			filterNode: function(value, data, node) {
				if(!value) return true;
				return data.label.indexOf(value) !== -1;
			},

			//选择框
			handleSelectionChange: function(val) {
				debugger;
				this.$data.multipleSelection = val;
			},

			//查询待入库车辆的选择框
			handleSelectionChangeCar: function(val) {
				debugger;
				this.$data.formData.multipleSelectionCar = val;
			},
			//列表，分页大小切换
			handleSizeChange: function() {},
			//列表,当前页切换
			handleCurrentChange: function(currentPage) {
				this.$data.CurentPage = currentPage;
				//this.$data.dictGroup = '';
				this.enterWarehouseQuery();
			},
		},
		//表单创建时执行
		created: function() {
			this.enterWarehouseQuery();

			//仓库下拉
			this.$http.get(this.API_ROOT + '/scm/warehouse/combo', {
				params: {}
			}).then((response) => {
				this.$data.warehouseId = response.data;
			}, (response) => {});

			//查找车型
			this.queryParamTree();

			//获取车辆入库类型下拉
			this.$http.get(this.API_ROOT + '/base/dict/combo', {
				params: {
					group: "scmEnterWarehouseType"
				}
			}).then((response) => {
				this.$data.enterWarehouseType = response.data;
			}, (response) => {});

			//获取车辆入库库龄下拉
			this.$http.get(this.API_ROOT + '/base/dict/combo', {
				params: {
					group: "enterWarehouseAge"
				}
			}).then((response) => {
				this.$data.enterWarehouseAge = response.data;
			}, (response) => {});

			//车辆销售状态下拉
			this.$http.get(this.API_ROOT + '/base/dict/combo', {
				params: {
					group: "scmWarehouseCarSaleStatus"
				}
			}).then((response) => {
				this.$data.carSaleStatus = response.data;
			}, (response) => {});

			//财务归属下拉
			this.$http.get(this.API_ROOT + '/base/dict/combo', {
				params: {
					group: "carFinancialBelong"
				}
			}).then((response) => {
				this.$data.financialBelong = response.data;
			}, (response) => {});

		}
	}
</script>
<style>
	.box-carda {
		width: 100%;
		height: 300px;
		margin-top: 20px;
		margin-bottom: 20px;
	}
	
	.box-cards {
		width: 100%;
		height: 100px;
		margin-top: 20px;
		margin-bottom: 20px;
	}
	
	.el-table .info-row {
		height: 10px !important;
	}
	
	.item {
		width: 30px;
	}
	
	.el-form-item {
		clear: both;
	}
	
	.el-dropdown .el-button-group,
	.el-table .el-tooltip,
	.el-table .el-tooltip__rel {
		display: inline;
	}
	
	.el-table {
		height: 100%;
		width: 100%;
	}
	
	#el-select {
		width: 200px;
	}
</style>